home *** CD-ROM | disk | FTP | other *** search
/ Workbench Add-On / Workbench Add-On - Volume 1.iso / BBS-Archive / Comm / AmiTCP30b2.lha / Install_AmiTCP < prev    next >
Text File  |  1994-05-19  |  55KB  |  1,561 lines

  1. ;;;; Hey Emacs, this script might as well be -*- lisp -*-
  2. ;;;;
  3. ;;;; Install_AmiTCP - AmiTCP/IP installation script for Installer
  4. ;;;;
  5. ;;;; Copyright © 1993 AmiTCP/IP Group, <amitcp-group@hut.fi>
  6. ;;;;
  7. ;;;; $Id: Install_AmiTCP,v 3.6 1994/05/19 04:19:33 ppessi Exp $
  8. ;;;;
  9. ;;;; This script has been tested with Installer 1.24:
  10. ;;;;
  11. ;;;;     Installer and Installer project icon
  12. ;;;;     (c) Copyright 1991-93 Commodore-Amiga, Inc.  All Rights Reserved.
  13. ;;;;     Reproduced and distributed under license from Commodore.
  14. ;;;;
  15. ;;;;     INSTALLER SOFTWARE IS PROVIDED "AS-IS" AND SUBJECT TO CHANGE;
  16. ;;;;     NO WARRANTIES ARE MADE.  ALL USE IS AT YOUR OWN RISK.  NO LIABILITY
  17. ;;;;     OR RESPONSIBILITY IS ASSUMED.
  18. ;;;;
  19. ;;;; Use following Icon tooltypes / Command line options:
  20. ;;;; APPNAME=AmiTCP/IP
  21. ;;;; MINUSER=AVERAGE
  22. ;;;;
  23. (welcome "    Welcome to " @app-name " 3.0 beta installation.\n"
  24.      "    We hope that after this installation your world of "
  25.      "communication will be much more broader than before.")
  26. ;;;;
  27. ;;;; What we are?
  28. ;;;;
  29. (set app-name (cat @app-name " 3.0ß2"))
  30.  
  31. ;;;;
  32. ;;;; "Needs"
  33. ;;;;
  34. (set need-version 37  ; version of operating system need by AmiTCP/IP
  35.      need-memory (* 512 1024))
  36. ;;;
  37. ;;; Destination directories of the AmiTCP/IP
  38. ;;;
  39. (set 
  40.  atcp-name "AmiTCP"
  41.  atcp-assign (cat atcp-name ":")    ; Assign to AmiTCP
  42.  ;; Exported files
  43.  export-dir (tackon atcp-assign "export")
  44.  ;; Configuration
  45.  conf-dir (tackon atcp-assign "db")
  46.  ;; User binaries
  47.  bin-dir (tackon atcp-assign "bin")
  48.  ;; documentation
  49.  doc-dir (tackon atcp-assign "doc")
  50.  ;; devices directory
  51.  devs-dir (tackon atcp-assign "devs")
  52.  ;; AmigaGuide documentation
  53.  help-dir (tackon atcp-assign "help")
  54.  ;; DOS handlers
  55.  l-dir (tackon atcp-assign "l")
  56.  ;; libraries
  57.  libs-dir (tackon atcp-assign "libs")
  58.  ;; source
  59.  src-dir (tackon atcp-assign "src")
  60.  ;; includes for net applications
  61.  include-dir (tackon atcp-assign "netinclude")
  62.  ;; network link libraries
  63.  lib-dir (tackon atcp-assign "netlib")
  64.  ;; daemons
  65.  serv-dir (tackon atcp-assign "serv")
  66.  ;;
  67.  ;; If you add directories above, then also add the name of the variable below.
  68.  ;; This is to have "for i in a b c d ..." construct
  69.  ;;
  70.  ;; These directories are always present
  71.  dir-pat (cat "(" "devs" "|" "db" "|" "bin" "|" "doc" "|" 
  72.           "help" "|" "l" "|" "libs" "|" "serv" ")")
  73.  ;; Optional directories
  74.  dir-pat-opt (cat "(" "netinclude" "|" "netlib" "|" "src" ")")
  75.  ;; The source directory name
  76.  source-dir (if (= 1 (exists @icon))
  77.             (pathonly (expandpath @icon))
  78.           (expandpath @icon))
  79.  ;; Mounts
  80.  tcp-mount (cat 
  81.         "Assign TCP: Exists > NIL:\n" 
  82.         "IF Warn\n"
  83.         "  Mount TCP: from AmiTCP:devs/Inet-Mountlist\n"
  84.         "EndIf\n")
  85.  )
  86.  ;; How to get needed information?
  87. (set
  88.  net-setup-help
  89.      "    You can get this information from your network administration.\n")
  90.  
  91. ;;; copy "more" to ram: to be able to use it
  92. (set
  93.  pager-cmd (if (exists "ENV:PAGER" (noreq)) (getenv "PAGER"))
  94.  pager-cmd 
  95.  (if pager-cmd pager-cmd 
  96.    (if (exists "SYS:Utilities/More" (noreq))
  97.        ((copyfiles
  98.      (prompt "Copying sys:utilities/more to ram: for use")
  99.      (source "SYS:Utilities/More")
  100.      (dest   "RAM:")
  101.      (safe)
  102.      (optional "nofail"))
  103.     "RAM:More")
  104.      ("more"))))
  105.  
  106. ;; Return old AmiTCP: assign if we are aborting
  107. (onerror
  108.  (if old-atcp-directory
  109.      (makeassign atcp-name old-atcp-directory)))
  110.  
  111. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  112. (procedure
  113.  ask-ip-address
  114.  ;;  Procedure to ask an IP address
  115.  ;;
  116.  ;; arguments:
  117.  ;;  ::ask-ip-prompt   - Prompt text
  118.  ;;  ::ask-ip-help     - help text
  119.  ;;  ::ask-ip-need     - empty result allowed if not true
  120.  ;;
  121.  ;; locally used names:
  122.  ;;  ::ask-ip-result
  123.  (set ::ask-ip-result "<none>")
  124.  (while
  125.      ((set ::ask-ip-result
  126.        (askstring
  127.         (prompt ::ask-ip-prompt
  128.             (if (NOT ::ask-ip-need)
  129.             (cat "\nGive an empty string if you want to "
  130.                  "by-pass this option."))
  131.             (if (NOT (= ::ask-ip-result "<none>"))
  132.             (cat "\n\nYou entered an invalid value\n\""
  133.                  ::ask-ip-result "\".\n"
  134.                  "Enter a valid IP address.")))
  135.         (default (if (<> ::ask-ip-result "<none>") ::ask-ip-result ""))
  136.         (help net-setup-help
  137.           ::ask-ip-help
  138.           "\n    Internet address is a string of at most four "
  139.           "decimal numbers separated by dots. For example, "
  140.           "\"130.233.161.40\" is a valid internet address.\n"
  141.           "    You will be asked again for the address, "
  142.           "if the address you entered is invalid.")))
  143.       ;; loop while answer is unacceptable
  144.       (if ::ask-ip-result
  145.       (NOT (patmatch "# #(1|2|3|4|5|6|7|8|9|0).#(1|2|3|4|5|6|7|8|9|0|.)# "
  146.              ::ask-ip-result))
  147.      ::ask-ip-need)))
  148.  ::ask-ip-result)
  149.  
  150. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  151. (procedure
  152.  check-system-version
  153.  ;; is your Exec recent enough?
  154.  (set exec-version (/ (getversion) 65536))
  155.  (transcript "Running on exec version " exec-version ".")
  156.  (if (< exec-version need-version)    ; check operating system version
  157.      ((message @app-name " needs at least Exec version " need-version
  158.            " to run.\nYou have only version " exec-version ".\n"
  159.            "You can proceed with the installation, but consider "
  160.            "installing the " @app-name " with proper version of "
  161.            "the operating system."
  162.            (help
  163.         "    The " @app-name " uses some system functions "
  164.         "that are not present or functional in earlier system "
  165.         "versions. Consider updating your system.\n"
  166.         "    If you have a later version of operating system "
  167.         "and are only now using older version: be sure to use "
  168.         "only release 2.04 or newer with " @app-name ". "
  169.         "No damage happens if you run " @app-name " with an "
  170.         "earlier operating system, however. It just "
  171.         "refuses to start.\n"
  172.         "    If you decide to continue, no changes will be made to "
  173.         "system startup files, so you must edit them yourself. "
  174.         "Refer instructions for manual installation."))
  175.       (transcript "User decided to continue installation while running "
  176.           "on operating system release earlier than 2.04."))))
  177.  
  178.  
  179. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  180. (procedure
  181.  check-available-memory
  182.  ;;
  183.  (transcript "Checking available memory.")
  184.  (set avail-mem (+ (database "total-mem")))
  185.  (if (< avail-mem need-memory)
  186.      ((message "Your system has only " (/ avail-mem 1024) " kilobytes of "
  187.            "free memory, while " @app-name " needs at least "
  188.            (/ need-memory 1024) " to be useful.\n"
  189.            "You can continue the installation but be warned!")
  190.       (transcript "User decided to continue installation while available "
  191.           "memory was below the recommended minimum."))))
  192.  
  193. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  194. (procedure
  195.  check-user-level
  196.  ;;
  197.  (transcript "Checking user level.")
  198.  (if (< @user-level 1)
  199.      ((transcript "Installation aborted due to too low user level.")
  200.       (abort "AmiTCP/IP installation requires at least the \"average\" "
  201.          "user level. Restart installation and select appropriate user "
  202.          "level."))))
  203.  
  204. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  205. (procedure
  206.  check-old-assign
  207.  ;; If there is already the AmiTCP/IP installed, store the assign
  208.  ;; to old-atcp-directory
  209.  (transcript "Checking for already installed AmiTCP.")
  210.  (if (exists atcp-assign (noreq))
  211.      (set old-atcp-directory (getassign atcp-name)))
  212.  (if old-atcp-directory
  213.      (transcript "Existing AmiTCP detected at directory " 
  214.          old-atcp-directory ".")))
  215.  
  216. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  217. (procedure
  218.  select-destination-directory
  219.  ;; Select destination directory for the installation. We suggest the user
  220.  ;; to install to the place from where the installer was started. This is
  221.  ;; since normally this software will be unarchived to its proper location
  222.  ;; and the files don't have to be copied any more.
  223.  ;;
  224.  (transcript "Selecting destination directory for the installation.")
  225.  (while
  226.      ((set @default-dest
  227.        (askdir
  228.         (prompt "Select directory where to install " @app-name ".\n"
  229.             "Most of the files don't have to be copied, if you accept "
  230.             "the offered default.")
  231.         (help "    Here you can specify location where to install "
  232.           "the " @app-name ".\n"
  233.           "    Installation can be made on-place. "
  234.           "This is recommended if you have already unarchived "
  235.           "the " @app-name " archive to its final location. "
  236.           "In this case "
  237.           "most of the files are left where they are. "
  238.           "Only necessary files are copied to different "
  239.           "positions.\n"
  240.           "    Installation must NOT be made on top of the 1.0 "
  241.           "version of the " @app-name)
  242.         (newpath)
  243.         (default source-dir)))
  244.       (if (= 2 (exists @default-dest))
  245.       ;; check that installation is not tried over the old version
  246.       (if (OR (exists (tackon @default-dest "bin/AmiTCP")) ; version 1.0
  247.           (> (getversion (tackon source-dir "AmiTCP"))
  248.              (if (exists (tackon @default-dest "AmiTCP"))
  249.              (getversion (tackon @default-dest "AmiTCP"))
  250.                $7FFFFFFF)))
  251.           ((message "You are possibly trying to install " @app-name " "
  252.             "over an old version of it.\n"
  253.             "It is not allowed.\n"
  254.             "You should select some other directory or abort "
  255.             "the installation.")
  256.            1)
  257.         0)
  258.     ((makedir @default-dest
  259.          (infos))
  260.      0))))
  261.  
  262.  ;; Make the AmiTCP: assign
  263.  (makeassign atcp-name @default-dest))
  264.  
  265. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  266. (procedure
  267.  copy-files-to-destination ;;; Copy all files if not installing on-place
  268.  ;;
  269.  (if (= source-dir
  270.     (expandpath @default-dest))
  271.      (message "\nSource and destination directories are the same, "
  272.           "not copying."
  273.           (help "    The " @app-name " files don't have to be copied, "
  274.             "since the source and destination directory are "
  275.             "the same"))
  276.    ((transcript "Copying " @app-name " files from " source-dir " to "
  277.         @default-dest ".")
  278.     (set dir-information
  279.      (cat
  280.       (if (exists "netinclude")
  281.           (cat "netinclude - include files needed for networking "
  282.            "applications development\n"))
  283.       (if (exists "netlib")
  284.          "netlib - link libraries for networking program development\n")
  285.       (if (exists "src")
  286.           (if (exists "src/util")
  287.           (cat "src - source code for libraries, examples"
  288.                "and all the binaries\n")
  289.         "src - source code for the libraries and examples\n"))
  290.       ))
  291.     (if (< 0 (strlen dir-information))
  292.     (if (askbool
  293.          (prompt "\nDo you want directories needed only with development "
  294.              "of " @app-name " or applications to be copied?")
  295.          (help "    These directories (and their contents) is "
  296.            "not needed to use AmiTCP/IP. "
  297.            "You need to copy them only when you plan to "
  298.            "make network programs by yourself.\n"
  299.            "    Description of directories:\n"
  300.            dir-information
  301.            (if (= @user-level 1)
  302.                "    If you select EXPERT level at start, you "
  303.              "    You ")
  304.            "will be prompted for each directory.\n"))
  305.         (foreach
  306.          source-dir dir-pat-opt
  307.          (copyfiles
  308.           (source source-dir)
  309.           (choices (fileonly @each-name))
  310.           (confirm)
  311.           (dest @default-dest)
  312.           (prompt
  313.            (if (= @user-level 1)
  314.            "Copying files to selected location."
  315.          "Copy this directory?"))
  316.           (help "    Description of directories:\n"
  317.             dir-information)
  318.           (optional "askuser")))))
  319.     (foreach source-dir dir-pat
  320.          ((set dest-dir (tackon @default-dest @each-name))
  321.           (if (NOT (exists dest-dir))
  322.           (makedir dest-dir))
  323.           (copyfiles (all)
  324.              (source (expandpath @each-name))
  325.              (dest dest-dir)
  326.              (prompt "Copying files to the selected location.")
  327.              (optional "askuser"))))
  328.     (copyfiles (source source-dir)
  329.            (dest @default-dest)
  330.            (prompt "Copying files to the selected location.")
  331.            (pattern "#?")
  332.            (files)
  333.            (infos)
  334.            (optional "askuser"))))
  335.  ;;
  336.  ;; Add script flags to the scripts, pure flags to pure programs
  337.  ;;
  338.  (protect (tackon bin-dir "ch_nfsctl") "+s +e")
  339.  (protect (tackon bin-dir "netstat") "+s +e")
  340.  (protect (tackon bin-dir "SynClock") "+s +e")
  341.  (protect (tackon bin-dir "stopnet") "+s +e")
  342.  (if (exists src-dir)
  343.      ((protect (tackon src-dir "compile") "+s +e")
  344.       (protect (tackon src-dir "compile.lib") "+s +e")))
  345.  (protect (tackon bin-dir "NapsaTerm") "+p +e")
  346.  (protect (tackon serv-dir "in.fingerd") "+p +e")
  347.  )
  348.  
  349. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  350. (procedure 
  351.  ;;
  352.  ;; Ask for the default user
  353.  ;;
  354.  ask-default-user
  355.  (if (= adu::setdefaults 0)
  356.      (set   
  357.       adu::setdefaults 1
  358.       default-user-name ""))
  359.  (while (= default-user-name "")
  360.    (set default-user-name
  361.     (askstring
  362.      (default default-user-name)
  363.      (prompt "Enter the default user name\n")
  364.      (help "    The AmiTCP/IP can handle currently only one user "
  365.            "at a time.  The default user is selected with `login' "
  366.            "command by system startup script. ")))))
  367.  
  368. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  369. (procedure
  370.  ask-hostname ;; Get host name and default domain
  371.  ;;
  372.  (procedure
  373.   setenv-hostname ;; Store hostname to the environment variable
  374.   ;;
  375.   ;; Tell the user that the environment variable HOSTNAME will be used.
  376.   ;;
  377.   (if
  378.       (askbool
  379.        (prompt "\nThe host name \"" my-full-name "\" will be stored to the "
  380.            "environment variable HOSTNAME where networking code "
  381.            "assumes it to be found.\n"
  382.            "This can be done in two ways: Either the variable is "
  383.            "stored to the ENV: and ENVARC: or a \"setenv\" command "
  384.            "is put to the s:user-startup.\n\n"
  385.            "Choose which to do:")
  386.        (choices "Store to ENV(ARC):" "Use \"setenv\"")
  387.        (default 1)
  388.        (help "    This variable must be set for the applications "
  389.          "to work correctly.\n"
  390.          "    The ENVARC: is the standard place to store environment "
  391.          "variables which must not peridh on a re-boot. "
  392.          "Select \"setenv\" only if you are sure that it is needed."))
  393.       ((set use-setenv-to-set-hostname 0)
  394.        (if (= 2 (exists "ENV:"))
  395.        (textfile (dest "ENV:HOSTNAME")
  396.              (append my-full-name)))
  397.        (if (= 2 (exists "ENVARC:"))
  398.        (textfile (dest "ENVARC:HOSTNAME")
  399.              (append my-full-name))))
  400.     ;; this variable will be used when the user-startup is updated
  401.     (set use-setenv-to-set-hostname 1)))
  402.  ;;
  403.  ;; Get the hostname from environment variable
  404.  ;;
  405.  (set def-full-name (if (exists "ENV:HOSTNAME")
  406.             (getenv "HOSTNAME")
  407.               "")
  408.       my-host-name ""
  409.       my-domain-name "")
  410.  ;;
  411.  ;; Break the name into the host and domain parts
  412.  ;;
  413.  (set ::index 0
  414.       ::length (strlen def-full-name))
  415.  (while (AND (< ::index ::length)
  416.          (NOT (= (substr def-full-name ::index 1) ".")))
  417.    (set ::index (+ ::index 1)))
  418.  (if (= ::index ::length)
  419.      (set def-host-name ""
  420.       def-domain-name "")
  421.    (set def-host-name (substr def-full-name 0 ::index)
  422.     def-domain-name (substr def-full-name (+ ::index 1))))
  423.  ;;
  424.  ;; Ask the host name from the user
  425.  ;;
  426.  (while (OR (= my-host-name "")
  427.         ;; check that name has no dots
  428.         ((set ::index 0
  429.           ::length (strlen my-host-name))
  430.          (while (AND (< ::index ::length)
  431.              (NOT (= (substr my-host-name ::index 1) ".")))
  432.            (set ::index (+ ::index 1)))
  433.          (NOT (= ::index ::length))))
  434.    (set my-host-name
  435.     (askstring
  436.      (prompt
  437.       (cat "\nEnter the host name of your computer (not including "
  438.            "domain)"
  439.            (if (= my-host-name "")
  440.            ":"
  441.          (cat ".\nThe value " my-host-name " is illegal, since it "
  442.               "contains a dot."))))
  443.      (help net-setup-help
  444.            "    Host name is a string NOT containing dots (.), "
  445.            "example: \"my-amiga\".\n"
  446.            "    Domain specifies the administrative domain of the "
  447.            "network where your host is connected. For example, "
  448.            "\"hut.fi\" is the domain name of the Helsinki "
  449.            "University of Technology in Finland.\n")
  450.      (default def-host-name))))
  451.  ;;
  452.  ;; ask the domain name from the user
  453.  ;;
  454.  (while (= my-domain-name "")
  455.    (set my-domain-name
  456.     (askstring
  457.      (prompt "\nEnter the domain part of your host name:")
  458.      (help net-setup-help
  459.            "    Domain specifies the administrative domain of the "
  460.            "network where your host is connected. For example, "
  461.            "\"hut.fi\" is the domain name of the Helsinki "
  462.            "University of Technology in Finland.\n")
  463.      (default def-domain-name))))
  464.  (set my-full-name (cat my-host-name "." my-domain-name))
  465.  (setenv-hostname))
  466.  
  467. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  468. (procedure
  469.  ask-aliases
  470.  ;;
  471.  (set my-host-aliases my-host-name)
  472.  (while
  473.      (set new-host-name
  474.       (askstring
  475.        (prompt "Give aliases to your computer " my-full-name
  476.            " one at a time."
  477.            (if my-host-aliases
  478.                (cat "\n\nAliases are:\n" my-host-aliases)))
  479.        (default (if my-host-aliases "" my-host-name))
  480.        (help net-setup-help
  481.          "    Your computer may have additional names "
  482.          "(aliases) to its official name. It is a customary "
  483.          "to have at least one alias, which "
  484.          "is the official host name without the domain part.\n")))
  485.    (set my-host-aliases (cat my-host-aliases " " new-host-name))))
  486.  
  487. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  488. (procedure
  489.  ask-domains
  490.  ;;
  491.  (set domain-list ""
  492.       text-domain-list "")
  493.  (while
  494.      (set domain
  495.       (askstring
  496.        (prompt
  497.         "Give domain names (one at a time) to search.\n"
  498.         "Press proceed after you have given each domain.\n"
  499.         "Give empty domain after you have finished.\n"
  500.         (if text-domain-list
  501.         (cat "\nIncluded domains are:"
  502.             text-domain-list)))
  503.       (help
  504.        net-setup-help
  505.        "    In many environments more than one search domain "
  506.        "is needed for name resolution.\n"
  507.        "    For example, most of computers in the Helsinki "
  508.        "University of Technology are under single domain: "
  509.        "\"hut.fi\", so the full name of computer named "
  510.        "\"vipu\" would be \"vipu.hut.fi\". If the default "
  511.        "domain is \"hut.fi\", then this computer can be "
  512.        "referred without the domain part of the name (just "
  513.        "\"vipu\"). However, the computer science department "
  514.        "has its own domain \"cs.hut.fi\". When computers of "
  515.            "the computer science department "
  516.        "are referred, the full name must be supplied, e.g. "
  517.        "\"colossus.cs.hut.fi\". This can be avoided by "
  518.        "providing \"cs.hut.fi\" as a secondary search domain. "
  519.        "The domains are searched in the given order. It is "
  520.        "fastest to give the most used domain first.\n"
  521.        "    In Unix systems the domain names are "
  522.        "usually stored into the file `/etc/resolv.conf`.\n")
  523.       (default (if domain-list "" my-domain-name))))
  524.   (set domain-list ("%sDOMAIN %s\n" domain-list domain)
  525.        text-domain-list (cat text-domain-list "\n" domain)
  526.        default-domain "")))
  527.  
  528. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  529. (procedure
  530.  update-devices
  531.  (transcript "Updating Sana-II device drivers.")
  532.  ;;
  533.  ;; Create directory DEVS:Networks if it does not exist already
  534.  ;;
  535.  (if (NOT (= 2 (exists "DEVS:Networks")))
  536.      (makedir "DEVS:Networks"))
  537.  ;;
  538.  ;; Copy each driver in the distribution to the DEVS:Networks if necessary
  539.  ;;
  540.  (working "Checking Sana-II device drivers...")
  541.  (set dist-networks-dir (tackon source-dir "export/Devs/Networks"))
  542.  (if (= 2 (exists dist-networks-dir))
  543.      (foreach
  544.        dist-networks-dir "#?.device"
  545.        ((set dist-name (tackon dist-networks-dir @each-name)
  546.          devs-name (tackon "DEVS:Networks" @each-name)
  547.          dist-version (getversion dist-name)
  548.          copy-it (NOT (exists devs-name)))
  549.     ;;
  550.     ;; Check if the driver should be copied over
  551.     ;;
  552.     (if (NOT copy-it)
  553.         (set copy-it
  554.                  ; or if the driver in DEVS:Networks is of older version
  555.          (< (set devs-version (getversion devs-name)) dist-version)))
  556.     (if (NOT copy-it)
  557.         (set copy-it
  558.              ; or if the files are of the same version but different
  559.          (set sum-differs (if (= dist-version devs-version)
  560.                       (<> (getsum dist-name)
  561.                       (getsum devs-name))
  562.                     0))))
  563.     (if copy-it
  564.         (copyfiles
  565.          (prompt "Confirm the copy.\n"
  566.              (if devs-version
  567.              (cat "A driver with the same name exists already"
  568.                   (if sum-differs
  569.                   (cat ", it has the same version, but the "
  570.                        "files are not the same.")
  571.                 (cat ", but the driver in the "
  572.                      "DEVS:Networks is of older version.")))
  573.                ""))
  574.          (help
  575.           "    The Sana-II drivers should be located in "
  576.           "the DEVS:Networks directory.\n"
  577.           "    This directory is the official location for the SANA-II "
  578.           "device drivers. Some other software may be able to use the "
  579.           "drivers, if they are copied over.")
  580.          (source (pathonly dist-name))
  581.          (choices (fileonly dist-name))
  582.          (dest "DEVS:Networks")
  583.          (files)
  584.          (optional "nofail" "askuser")
  585.          (confirm "average"))))))
  586.  
  587.  ;;; ask user which export/Env/Sana2 files should be copied
  588.  (if (= 2 (exists (tackon source-dir "export/Env/Sana2")))
  589.      (if
  590.      (askbool (prompt "\nDo you want to install example Sana-II "
  591.               "configuration files?\n"
  592.               "Copies will be confirmed.")
  593.           (help "    This release contains example configuration "
  594.             "files for the SLIP devices and Agnet (a Sana-II "
  595.             "pseudo device).\n"
  596.             "    The copying of each file will confirmed.")
  597.           (default 1))
  598.      (copyfiles
  599.       (prompt "Select Sana-II configuration files to be copied:")
  600.       (help "    These configuration files are for example only. "
  601.         "You need to edit them for them to be useful. Refer to "
  602.         "the documentation of the Sana-II device in question. "
  603.         "The AmiTCP:doc directory contains documentation for "
  604.         "the drivers included in this release.\n"
  605.         "    The files will be copied to the ENVARC: by default. "
  606.         "Normally they will be copied to ENV: on next reboot.")
  607.       (source (tackon source-dir "export/Env/Sana2"))
  608.       (dest "ENVARC:sana2")
  609.       (all)
  610.       (files)
  611.       (optional "nofail" "askuser")
  612.       (confirm "average")))
  613.    ))
  614.  
  615. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  616. ;;;
  617. ;;; Ask network interfaces
  618. ;;;
  619. ;;; Loop until no device is given.
  620. ;;;
  621. (procedure
  622.  ask-interfaces
  623.  ;;
  624.  ;; Procedure to ask the network device driver name
  625.  ;;
  626.  ;; (Returns TRUE if an interface file exists..)
  627.  ;;
  628.  (procedure
  629.   if-ask-device
  630.   (while
  631.       ((set my-host-if
  632.         (askfile
  633.          (prompt
  634.           "Select a SANA-II device driver. If you have set "
  635.           "up all your interfaces, just press proceed.")
  636.          (default "Devs:Networks")
  637.          (help
  638.           "    Select the name of a SANA-II device to be used, "
  639.           "like \"a2065.device\" or \"rhslip.device\" for the "
  640.           "A2065 ethernet adapter or SLIP driver, respectively.\n"
  641.           "    Primary address of your computer is the one "
  642.           "with which your computer will most often be referenced.\n"
  643.           "    If you are going to attach your computer to "
  644.           "several networks (by using many network "
  645.           "adapters), different address must be assigned to "
  646.           "each adapter.\n"
  647.           "    When you have configured all your network "
  648.           "interfaces, select no file to continue. This can be done by "
  649.           "entering nothing to the \"file\" gadget.")))
  650.        ;;
  651.        ;; Try to ensure that we get at least 1 SANA-II network interface
  652.        ;;
  653.        (if (AND (= address-list "")
  654.         (= 2 (exists my-host-if)))
  655.        (askbool
  656.         (prompt
  657.          "\nYou have not defined any SANA-II network interface for "
  658.          "the " @app-name ". You should define at least one "
  659.          "external interface. It is crucial for the correct "
  660.          "operation even if you are using " @app-name " "
  661.          "locally with internal loopback device.\n"
  662.          "    For the moment you can give "
  663.          "the interface a random IP address (eg. 126.1). "
  664.          "Reinstall " @app-name " when you get a real "
  665.          "network connection.\n\n"
  666.          "Do you want to define a network interface for "
  667.          @app-name "?")
  668.         (help
  669.          "    Each IP packet must be given a source address. "
  670.          "AmiTCP/IP stamps each packet which it sends with an "
  671.          "address of some external interface. "
  672.          "Because of an internal design of the AmiTCP/IP, "
  673.          "the source address can not be local. (Local address is "
  674.          "any address configured to the internal loopback "
  675.          "interface, normally 127.1).\n")))))
  676.   ;; If user gives no file, a directory is actually given
  677.   (if (= 2 (exists my-host-if))
  678.       ""
  679.     my-host-if))
  680.  
  681.  ;;
  682.  ;; Ask for the unit number
  683.  ;;
  684.  (procedure
  685.   if-ask-unit
  686.   (set my-host-if-unit
  687.        (asknumber
  688.     (prompt "\nSelect unit number for the " my-host-if ":")
  689.     (default 0)
  690.     (help "    Select the unit number for the SANA-II device driver "
  691.           my-host-if " to use. This is usually 0 for the first "
  692.           "unit of that particular device. "
  693.           "Refer your device driver documentation for "
  694.           "correct number to use."))))
  695.  
  696.  ;;
  697.  ;; Ask for the IP address of this host
  698.  ;;
  699.  (procedure
  700.   if-ask-address
  701.   (set ::ask-ip-prompt (cat "IP address for the interface " my-host-if
  702.                 "/" my-host-if-unit ".\n"
  703.                 "Each interface must have an unique\n"
  704.                 "Internet Protocol address.")
  705.        ::ask-ip-help (cat "    If you have no actual network connection, "
  706.               "you may give a nonexistent IP number for "
  707.               "your external interface.")
  708.        ::ask-ip-need 1
  709.        my-host-addr (ask-ip-address)))
  710.  
  711.  ;;
  712.  ;; Ask for the optional destination address
  713.  ;;
  714.  (procedure
  715.   if-ask-dest-address
  716.   (set ::ask-ip-prompt (cat "Give the destination address for the "
  717.                 my-host-if "/" my-host-if-unit ".\n"
  718.                 "Address of interface is " my-host-addr ".\n"
  719.                 "This is should give the destination address "
  720.                 "ONLY if you have a point-to-point interface "
  721.                 "(e.g. SLIP). You should give NO destination "
  722.                 "address for broadcast interface (e.g. Ethernet)."
  723.                 "\n")
  724.        ::ask-ip-help (cat
  725.               "    A point-to-point device is one that is connected"
  726.               " to a medium which only two devices can attach, for "
  727.               "example the normal serial line: your computer is in "
  728.               "other end and the other computer is on the other "
  729.               "end (maybe via modem, that does not change it).\n"
  730.               "    Ethernet, for example, is not a "
  731.               "point-to-point device because several devices "
  732.               "can connect to single physical medium.")
  733.        ::ask-ip-need 0
  734.        dest-host (ask-ip-address)))
  735.  
  736.  ;;
  737.  ;; Ask for the netmask for this interface. If nothing is given,
  738.  ;; a default value will be used by the ifconfig.
  739.  ;;
  740.  (procedure
  741.   if-ask-netmask
  742.   (set ::ask-ip-prompt (cat "Netmask of network on interface " my-host-if
  743.                 "/" my-host-if-unit ".\n"
  744.                 "Address of interface is " my-host-addr
  745.                 (if dest-host
  746.                 (cat ",\ndestination address is " dest-host ".\n")
  747.                   (cat ".\n")))
  748.        ::ask-ip-help (cat "    Netmask is a dot separated string of four "
  749.               "decimal numbers (similar "
  750.               "to an internet address), which specifies which "
  751.               "bits of the host address are used as the "
  752.               "network address.\n"
  753.               "    For example, \"255.255.255.0\" "
  754.               "is a possible netmask.\n"
  755.               "    The netmask must be same for all interfaces "
  756.               "connected to the same network.\n"
  757.               "    If you do NOT give a netmask (i.e. leave it "
  758.               "empty), it will be computed from your interface "
  759.               "address. This is correct only if the network "
  760.               "is not divided into subnets.")
  761.        ::ask-ip-need 0
  762.        my-host-netmask (ask-ip-address)))
  763.  
  764.  ;;
  765.  ;; Ask for confirmation on given information
  766.  ;;
  767.  (procedure
  768.   if-confirmation
  769.   (askbool
  770.    (prompt "This is the information you gave for this interface:\n"
  771.        "\nSANA-II driver: " my-host-if
  772.        "\nUnit number: " my-host-if-unit
  773.        "\nInterface address: " my-host-addr
  774.        "\nDestination address: " (if (= dest-host "") "<none>"
  775.                        dest-host)
  776.        "\nNetmask: " (if (= my-host-netmask "") "<use default>"
  777.                my-host-netmask)
  778.        "\n\nIs this correct?")
  779.    (help "    Check the information shown. If you do not confirm it, "
  780.      "all of it will be asked again.")))
  781.  
  782.  ;;
  783.  ;; Set startup string to contain configuration for the loopback device
  784.  ;; (Other information will be later appeneded to this string variable).
  785.  ;;
  786.  (set su-script
  787.       (cat "; configure loop-back device\n"
  788.        (tackon bin-dir "ifconfig") " lo/0 localhost\n")
  789.       ;; a complete list for IP address to host name mappings..
  790.       address-list "")
  791.  ;;
  792.  ;; Ask for interfaces
  793.  ;;
  794.  (while
  795.      (if-ask-device)
  796.    (if-ask-unit)
  797.    (if-ask-address)
  798.    (if-ask-dest-address)
  799.    (if-ask-netmask)
  800.    (if (if-confirmation)
  801.        ((transcript "Adding interface " my-host-if "/" my-host-if-unit )
  802.     (set
  803.      ;; Add this interface to the script string
  804.      su-script
  805.      (cat su-script
  806.           "; Configure " my-host-if " unit " my-host-if-unit "\n"
  807.           (tackon bin-dir "ifconfig") " "
  808.           my-host-if "/" my-host-if-unit " " my-host-addr " "dest-host
  809.           (if my-host-netmask
  810.           (cat " netmask " my-host-netmask))
  811.           "\n")
  812.      ;; Add IP address entry for this IP number
  813.      address-list
  814.      (cat address-list
  815.           "HOST " my-host-addr " " my-full-name " " my-host-aliases "\n")
  816.      )))))
  817.  
  818. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  819. (procedure
  820.  ask-gateway ;;; Ask the default gateway address
  821.  ;;
  822.  (set ::ask-ip-prompt "Enter the IP address of the default gateway:"
  823.       ::ask-ip-help (cat
  824.              "    All network packets for destinations for which "
  825.              "there is no defined route, are sent to the default "
  826.              "gateway, which (hopefully) can send them towards "
  827.              "the destination host.\n"
  828.              "    The IP address (instead of a name) is needed, "
  829.              "because the name may not be resolved without the "
  830.              "gateway, if the name server is not "
  831.              "in your local network.")
  832.       ::ask-ip-need 0
  833.       def-gateway-addr (ask-ip-address))
  834.  ;;
  835.  (set su-script
  836.       (cat su-script
  837.        "; Add route to this host\n"
  838.        (tackon bin-dir "route") " add " my-full-name " localhost\n"
  839.        (if def-gateway-addr
  840.            (cat "; Add route to the default gateway\n"
  841.             (tackon bin-dir "route")
  842.             (" add default %s\n" def-gateway-addr))))))
  843.  
  844. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  845. (procedure
  846.  ask-nameservers ;;; Ask addresses to the name servers
  847.  ;;
  848.  (set name-server-list ""
  849.       name-server-text-list "")
  850.  (while
  851.      (set ::ask-ip-prompt
  852.       (cat "Enter the IP addresses of the name servers (one at a time). "
  853.            "The name servers will be searched in the given order.\n"
  854.            (if name-server-text-list
  855.            ("\nIncluded name servers are: %s\n"
  856.             name-server-text-list)))
  857.       ::ask-ip-help
  858.       (cat "    A name server is used to resolve host "
  859.            "names to internet addresses. This allows you "
  860.            "to use symbolic names for the hosts instead "
  861.            "of internet addresses.\n"
  862.            "    In Unix systems the name server addresses are "
  863.            "usually stored into the file `/etc/resolv.conf`.\n")
  864.       ::ask-ip-need 0
  865.       name-server-addr (ask-ip-address))
  866.    (set name-server-list (cat name-server-list
  867.                   "NAMESERVER " name-server-addr "\n")
  868.     name-server-text-list (cat name-server-text-list "\n"
  869.                    name-server-addr))))
  870.  
  871. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  872. (procedure
  873.  create-config-file
  874.  ;;
  875.  (textfile (dest (tackon conf-dir "netdb-myhost"))
  876.        (append
  877.         (if address-list (cat "; This host\n" address-list)))
  878.        (append
  879.         (if domain-list (cat "; Domain names\n" domain-list)))
  880.        (append
  881.         (if name-server-list (cat "; Name servers\n" name-server-list)))))
  882.  
  883. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  884. (procedure
  885.  create-startup-script
  886.  ;;
  887.  ;; Create the network startup-script (AmiTCP:bin/startnet)
  888.  ;;
  889.  (textfile (dest (tackon bin-dir "startnet"))
  890.        (append
  891.         "run AmiTCP:AmiTCP\n"
  892.         "WaitForPort AMITCP\n")
  893.        (append su-script)
  894.        (append tcp-mount)
  895.        (append
  896.         (if (askbool
  897.          (prompt "\nDo you want the Inetd to be started at the "
  898.              @app-name " startup?\n")
  899.          (help "    Inetd is the Internet `Super Server', which "
  900.                "listens for connections on behalf of other "
  901.                "servers. When a connection request for a port, "
  902.                "for which Inetd is configured to listen, arrives "
  903.                "Inetd accepts the connections and starts the "
  904.                "server in question.\n"
  905.                "    The file " (tackon conf-dir "inetd.conf")
  906.                " contains the configuration information for the "
  907.                "Inetd, which you will want to edit.\n"
  908.                "    Currently only finger daemon is distributed "
  909.                "with " @app-name ".\n"
  910.                "    Refer to the documentation for more information."))
  911.         (cat "; Start the internet `super server'\n"
  912.              "run AmiTCP:bin/inetd\n")
  913.           "\n")))
  914.  (protect (tackon bin-dir "startnet") "+s +e"))
  915.  
  916. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  917. (procedure
  918.  update-user-startup
  919.  ;;
  920.  (set to-be-added-to-startup
  921.       (cat (if use-setenv-to-set-hostname
  922.            (cat "setenv HOSTNAME " my-full-name "\n")
  923.          "")
  924.        "assign " atcp-assign " " @default-dest "\n"
  925.        "path " bin-dir " add\n"
  926.        (tackon bin-dir "login") " -f " default-user-name 
  927.        " >\"con:*/*/*/200/AmiTCP-IP Login/AUTO/CLOSE/WAIT\"\n"
  928.        (tackon bin-dir "umask") " 022\n"
  929.        (if (askbool
  930.         (prompt
  931.          "\nDo you want the " @app-name
  932.          " to be started at the system startup?")
  933.         (help
  934.          "    If you decide not to start " @app-name " at startup, "
  935.          "you can later start it by giving command\n\n"
  936.          "run " (tackon bin-dir "startnet")
  937.          "\n\n at the command shell."))
  938.            ((set started-at-boot 1)
  939.         (cat "run " (tackon bin-dir "startnet\n")))
  940.          ((set started-at-boot 0)
  941.           ""))
  942.        (if (AND
  943.         (= 2 (exists include-dir))
  944.         (= 2 (exists lib-dir)))
  945.            (if (askbool
  946.             (prompt "\nDo you want to add assigns to "
  947.                 "netinclude and netlib directories?")
  948.             (help "    These assigns are only needed for compiling "
  949.               "programs using the " @app-name "."))
  950.            (cat "; assigns for programmers\n"
  951.             "assign netinclude: " include-dir "\n"
  952.             "assign netlib: " lib-dir "\n"))))
  953.       complete-to-be-added-to-startup (cat ";BEGIN " @app-name "\n"
  954.                        to-be-added-to-startup
  955.                        ";END " @app-name "\n"))
  956.  ;; Ask for confirmation to add
  957.  (if (>= exec-version 37)
  958.      (if
  959.      (askbool
  960.       (prompt "\nDo you want Installer to make the required changes to "
  961.           "your s:user-startup script?\n"
  962.           "\n(There is a problem with Installer making these "
  963.           "changes if you do not have the original boot volume "
  964.           "mounted. Installer may crash or corrupt your system "
  965.           "in that case.)")
  966.       (help "If you do not want Installer make the changes, it will "
  967.         "create a script file containing commands which you should "
  968.         "add to the s:user-startup file."))
  969.      ;; Do the addition
  970.      (startup
  971.       @app-name
  972.       (command to-be-added-to-startup)
  973.       (prompt "Installer will modify your S:User-Startup file. "
  974.           "Following lines will be appended to it:\n\n"
  975.           complete-to-be-added-to-startup)
  976.       (help "   Installer needs to make indicated modifications to "
  977.         "your user startup file to make sure that everything is "
  978.         "correctly set up to run " @app-name ".\n"
  979.         "   You should make modifications later by hand "
  980.         "if you skip this part."))
  981.        ;; Let user add commands
  982.        ((set addition-to-user-startup
  983.          (tackon atcp-assign "addition-to-user-startup"))
  984.     (textfile (dest addition-to-user-startup)
  985.           (append complete-to-be-added-to-startup))
  986.     (message "Installer created file " addition-to-user-startup
  987.          ", which you can add to your startup file by hand. "
  988.          "The file includes following changes:\n\n"
  989.          complete-to-be-added-to-startup)))))
  990.  
  991. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  992. (procedure
  993.  ask-copy-old-configuration
  994.  ;;
  995.  ;; Copy old configuration files
  996.  ;;
  997.  (set
  998.   edit-change-fingerd "t:edit-change-fingerd"
  999.   old-conf-dir (tackon old-atcp-directory "db")
  1000.   old-netdb-myhost (tackon old-conf-dir "netdb-myhost")
  1001.   old-startnet (tackon old-atcp-directory "bin/startnet"))
  1002.  ;;
  1003.  (procedure 
  1004.   copy-myhost-config 
  1005.   (if (>= @user-level 2)
  1006.       (message "\nCopying files\n\n"
  1007.            old-netdb-myhost "\n"
  1008.            old-startnet "   \n"
  1009.            "\nto directory \"" @default-dest "\"."))
  1010.   (copyfiles
  1011.    (source old-netdb-myhost)
  1012.    (dest conf-dir)
  1013.    (files))
  1014.   (copyfiles
  1015.    (source old-startnet)
  1016.    (dest bin-dir)
  1017.    (files)))
  1018.  ;;
  1019.  (procedure 
  1020.   copy-rest-config
  1021.   (copyfiles
  1022.    (prompt
  1023.     "Select configuration files you want to copy from old configuration")
  1024.    (help
  1025.     "    You may copy your old configuration files or use untouched files "
  1026.     "came with the new distribution.")
  1027.    (source old-conf-dir) 
  1028.    (dest conf-dir)
  1029.    (files)
  1030.    (confirm)
  1031.    (if (exists (tackon old-conf-dir "passwd"))
  1032.        (choices
  1033.     "AmiTCP.config"
  1034.     "inetd.conf"
  1035.     "netdb"
  1036.     "hosts"
  1037.     "services"
  1038.     "protocols"
  1039.     "passwd"
  1040.     "group")
  1041.      (choices 
  1042.       "AmiTCP.config"
  1043.       "inetd.conf"
  1044.       "netdb"
  1045.       "hosts"
  1046.       "services"
  1047.       "protocols"))
  1048.    (optional "nofail" "force" "askuser")))
  1049.  ;;
  1050.  (procedure 
  1051.   update-startnet
  1052.   (set startnet-file (tackon bin-dir "startnet"))
  1053.   (if (run (cat "search search \"Mount TCP:\" quiet from " startnet-file)
  1054.        (safe))
  1055.       ((textfile (dest startnet-file)
  1056.          (include startnet-file)
  1057.         (append tcp-mount "\n")
  1058.         (prompt 
  1059.          "\nDo you want to mount TCP: device at network startup?")
  1060.         (help 
  1061.          @app-name " includes a DOS handler for TCP communications. "
  1062.          "This DOS handler will usually be mounted at network "
  1063.          "startup.")
  1064.         (confirm))
  1065.        (protect (tackon bin-dir "startnet") "+s +e"))))
  1066.  (procedure
  1067.   update-services
  1068.   (set service-file (tackon conf-dir "services"))
  1069.   (if (run (cat "search search \""amiganetfs"\" quiet from " service-file)
  1070.        (safe))
  1071.       (;; Not found, add it 
  1072.        (textfile (dest service-file)
  1073.          (include service-file)
  1074.         (append ";\n; Amiga specific services\n;\n"
  1075.             "amiganetfs      2500/tcp\n")
  1076.         (prompt 
  1077.          "Do you want to add AmigaNetFS service to your "
  1078.          "service database?")
  1079.         (help 
  1080.          @app-name " includes NetFS, network file system between "
  1081.          "Amigas, by Timo Rossi. It is a TCP based protocol which "
  1082.          "requires both ends of connection have same service "
  1083.          "(TCP port) entries. If you already had NetFS installed "
  1084.          "you probably do not want to update your service "
  1085.          "database.")
  1086.         (confirm)))))
  1087.  (procedure
  1088.   update-inetd-conf
  1089.   ;; Change fingerd to serv/in.fingerd
  1090.   (set inetd-conf (tackon atcp-assign "db/inetd.conf"))
  1091.   (if (run (cat "search search \"serv/in.fingerd\" quiet from " inetd-conf)
  1092.        (safe))
  1093.       ((textfile 
  1094.     (dest edit-change-fingerd)
  1095.     (append
  1096.      "f b/finger    stream/\n"
  1097.      "e -amitcp:bin/fingerd-amitcp:serv/in.fingerd-\n"
  1098.      "m+"
  1099.      "i"
  1100.      "# NetFS, a networking support between Amigas"
  1101.      "# Remove # from the next line to enable NetFS"
  1102.      "#amiganetfs stream    tcp nowait root amitcp:serv/netfs-server"
  1103.      "Z"
  1104.      "w\n")
  1105.     (safe))
  1106.        (run (cat "c:edit from " inetd-conf " with "
  1107.          edit-change-fingerd " >t:what-changed")
  1108.         (confirm)
  1109.         (prompt "\nUpdate \"inetd.conf\" to use " @app-name " services?")
  1110.         (help "    The fingerd service daemon is moved to directory "
  1111.           "\"AmiTCP:serv\", and \"inetd.conf\" must be updated to use "
  1112.           "it. Also the NetFS must be added to old configuration")))))
  1113.  ;;
  1114.  (procedure 
  1115.   update-napsaprefs
  1116.   (set old-napsaprefs
  1117.        (if (exists (tackon old-atcp-directory "db/NapsaPrefs") (noreq))
  1118.        (tackon old-atcp-directory "db/NapsaPrefs")
  1119.      (if (exists "s:NapsaPrefs")
  1120.          "s:NapsaPrefs")
  1121.      ""))
  1122.   (if old-napsaprefs
  1123.       (;;
  1124.        (copyfiles 
  1125.     (source old-napsaprefs)
  1126.     (dest conf-dir)
  1127.     (files)
  1128.     (confirm)
  1129.     (prompt "\nUse your old Napsaterm preferences?")
  1130.     (help  "    Installer have found an existing NapsaPrefs file "
  1131.            old-napsaprefs ". You can copy it to new configuration "
  1132.            "directory.")))))
  1133.  (procedure 
  1134.   copy-extra-binaries
  1135.   "")
  1136.  (transcript "Ready to copy old configuration.")
  1137.  (if (askbool
  1138.       (default 1)
  1139.       (prompt
  1140.        "\nDo you want to use settings from earlier installation?")
  1141.       (help
  1142.        "    Installer have detected existing configuration "
  1143.        "directory \"" old-conf-dir "\" which "
  1144.        "can be used to configure " @app-name ". You can keep most "
  1145.        "of your previous configuration. This is important if you have "
  1146.        "installed extra applications.\n"
  1147.        "    Installer will copy your \"" old-startnet "\" script and "
  1148.        "\"" old-netdb-myhost "\" configuration "
  1149.        (if (> @user-level 1) 
  1150.        "and optionally "
  1151.      "then ")
  1152.        "other configuration files" (if "" "and binaries") ".\n"))
  1153.      ((copy-myhost-config)
  1154.       (copy-rest-config)
  1155.       (update-inetd-conf)
  1156.       (update-services)
  1157.       (update-startnet)
  1158.       (update-napsaprefs)
  1159.       (copy-extra-binaries)
  1160.       "Already configured")
  1161.    ""))
  1162.  
  1163. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1164. (procedure
  1165.  install-emacstcp
  1166.  ;; is GNU Emacs installed?
  1167.  (if (exists "GNUEmacs:" (noreq)) ; check if GNUEmacs is installed
  1168.      (if (exists (tackon source-dir "export/GNUEmacs"))
  1169.      ((transcript "Installing GNUEmacs support files.")
  1170.       (copyfiles
  1171.        (source (tackon source-dir "export/GNUEmacs/lisp"))
  1172.        (prompt "Copying GNU Emacs lisp files to GNUEmacs:lisp")
  1173.        (help "   Emacs lisp files implement the Emacs side of the "
  1174.          "Gnu Emacs TCP support.")
  1175.        (pattern "#?.el#?")
  1176.        (dest "GNUEmacs:lisp")
  1177.        (optional "nofail" "askuser")
  1178.        (confirm))
  1179.       (copyfiles
  1180.        (source (tackon source-dir "export/GNUEmacs/etc"))
  1181.        (choices "tcp_AmiTCP")
  1182.        (prompt "Copying tcp_AmiTCP (program) to GNUEmacs:etc")
  1183.        (help "   tcp_AmiTCP implements the " @app-name " side of the "
  1184.          "Gnu Emacs TCP support.")
  1185.        (dest "GNUEmacs:etc")
  1186.        (optional "nofail" "askuser")
  1187.        (confirm))
  1188.       (if (exists "GNUEmacs:etc/tcp_AmiTCP")
  1189.           (protect "GNUEmacs:etc/tcp_AmiTCP" "+p")) ; tcp is pure
  1190.       ;; Tell user what to do with .emacs
  1191.       (run (cat "run " pager-cmd)
  1192.            (tackon source-dir "export/GNUEmacs/add_to_.emacs")
  1193.            (safe)))
  1194.        (message "GNUEmacs not present in " source-dir "."))
  1195.    (message "GNU Emacs must be installed before....")))
  1196.  
  1197. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1198. (procedure
  1199.  ask-install-emacstcp
  1200.  ;; is GNU Emacs installed?
  1201.  (if (exists "GNUEmacs:" (noreq)) ; check if GNUEmacs is installed
  1202.      (if (exists (tackon source-dir "export/GNUEmacs"))
  1203.      (if (askbool
  1204.           (prompt "\nDo you want to install needed files for GNU Emacs "
  1205.               "support?")
  1206.           (help
  1207.            "    Installer has noticed that you have GNUEmacs: assigned "
  1208.            "in your system. Normally this means that you have the "
  1209.            "GNU Emacs installed.\n"
  1210.            "    AmiTCP/IP provides an Emacs extension, which makes "
  1211.            "it possible to run networking programs with it. To enable "
  1212.            "this feature some files need to be installed "
  1213.            "in to directories under \"GNUEmacs:\".\n"
  1214.            "    If you select \"Yes\", files will be installed and you "
  1215.            "will be able to use TCP/IP applications written for "
  1216.            "GNU Emacs."))
  1217.          (install-emacstcp)
  1218.        (transcript "User denied adding AmiTCP/IP support for GNU Emacs."))
  1219.        (transcript "GNUEmacs not present on " source-dir "."))
  1220.    (transcript "No GNU Emacs detected in system.")))
  1221.  
  1222. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1223. (procedure
  1224.  install-napsaterm
  1225.  ;;
  1226.  ;; Install Napsaterm fonts
  1227.  ;;
  1228.  ;; Ask for directory to install fonts.
  1229.  (procedure
  1230.   ask-napsa-font-dir
  1231.   (askdir
  1232.    (prompt "Select directory where to install Napsaterm fonts.\n")
  1233.    (help "    Here you can specify location where to install "
  1234.      "the Napsaterm font called `napsa'. "
  1235.      "This directory should be in your font path "
  1236.      "(i.e. some directory in the assign fonts:).")
  1237.    (newpath)
  1238.    (default "fonts:")))
  1239.  (copyfiles
  1240.   (source (tackon source-dir "export/Fonts"))
  1241.   (prompt "Copying font `napsa' to " napsa-font-dir ".")
  1242.   (dest (ask-napsa-font-dir))
  1243.   (optional "nofail")
  1244.   (fonts)
  1245.   (all)))
  1246.  
  1247. (procedure
  1248.  ask-install-napsaterm
  1249.  ;; Optionally intall Napsafonts
  1250.  (if (askbool
  1251.       (prompt "Do you want to install Napsaterm fonts, napsa?\n"
  1252.        "\n    (Napsaterm uses the special fonts in its window "
  1253.        "if they are installed. "
  1254.        "They are sized 6×11 pixels and contain some special VT102 "
  1255.        "characters. They are suitable for interlaced screens. "
  1256.        "If you have normal NTSC or PAL screen, it might be better to not "
  1257.        "install Napsa and use Topaz/8.)\n")
  1258.       (help
  1259.        "    Napsaterm is a VT102 terminal emulator which uses the rlogin "
  1260.        "protocol. You can have a remote login to many hosts in Internet "
  1261.        "with Napsaterm.\n"
  1262.        "    Napsaterm is based on the Niftyterm 1.2 written by "
  1263.        "Todd Williamson and Christopher J. Newman."))
  1264.      (install-napsaterm)))
  1265.  
  1266. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1267. (procedure 
  1268.  ;;
  1269.  ;; Add a new user into AmiTCP:db/passwd
  1270.  ;;
  1271.  add-new-user
  1272.  (if (= anu::setdefaults 0)
  1273.      (set   
  1274.       anu::passwd (tackon conf-dir "passwd")
  1275.       anu::passwd-new (cat anu::passwd ".new")
  1276.       anu::passwd-old (cat anu::passwd ".old")
  1277.       anu::tempfile "t:run-the-password"
  1278.       anu::helptext (cat "    You must give an login name, user ID, group ID"
  1279.              "real name and home directory for each user.\n")
  1280.       anu::setdefaults 1
  1281.       anu::username ""
  1282.       anu::UID 100
  1283.       anu::GID 100
  1284.       anu::realname ""
  1285.       anu::homedir "HOME:"
  1286.       anu::shell "shell"))
  1287.  (while
  1288.   (askbool (prompt "\nDo you want to create new user?")
  1289.        (choices "Proceed" "Cancel")
  1290.        (help "    You are about to add new users into user database."
  1291.          "You should be logged in as `root' while adding new users\n"))
  1292.   ((set anu::username
  1293.        (askstring
  1294.         (default anu::username)
  1295.         (prompt "Enter the login name of new user\n")
  1296.         (help anu::helptext
  1297.           "    The login name consists of lowercase letters a-z "
  1298.           "and numbers.  Its recommended maximum length is 8 "
  1299.           "characters.\n"
  1300.           "    Examples of acceptable login names are `ppessi' "
  1301.           "and `an345'.")))
  1302.       (set anu::UID
  1303.        (asknumber
  1304.         (default anu::UID)
  1305.         (prompt (cat "Enter the user ID of user " anu::username "\n"))
  1306.         (help anu::helptext
  1307.           "    The user ID is a numeric identifier for each user. "
  1308.           "It is a number between 100 - 32767 for ordinary users.\n")))
  1309.       (set anu::GID
  1310.        (asknumber
  1311.         (default anu::GID)
  1312.         (prompt (cat "Enter the primary group ID of user " 
  1313.              anu::username "\n"))
  1314.         (help anu::helptext
  1315.           "    The group ID is a numeric identifier of groups. "
  1316.           "Each user has a primary group, which is usually 100, "
  1317.           "group \"users\".\n")))
  1318.       (set anu::RealName
  1319.        (askstring
  1320.         (default anu::realname)
  1321.         (prompt (cat "Enter the real name of user " anu::username "\n"))
  1322.         (help anu::helptext
  1323.           "    The real name can contain any characters except "
  1324.           "comma (`,'), colon (`:') or bar (`|').")))
  1325.       (set anu::homedir
  1326.        (askdir
  1327.         (default anu::homedir)
  1328.         (prompt (cat "Give the home directory of user" anu::username "\n"))
  1329.         (help anu::helptext
  1330.           "    When user logs in, the current directory is changed to"
  1331.           "her home directory.  Also, the finger information (plan"
  1332.           "and project) is retrieved from home directory.")
  1333.         (newpath)))
  1334.       (set anu::shell
  1335.        (askstring
  1336.         (default anu::shell)
  1337.         (prompt (cat "Enter the name of command interpreter for user "
  1338.              anu::username "\n"))
  1339.         (help anu::helptext
  1340.           "    The command interpreter value can be either "
  1341.           "`shell' or `cli'.")))
  1342.       (set anu::passwd-entry 
  1343.        (cat anu::username "||" anu::UID "|" anu::GID "|" 
  1344.         anu::RealName "|" anu::homedir "|" anu::shell "\n"))
  1345.       (if (askbool 
  1346.        (prompt (cat "Are you sure you want to add following user:\n\n"
  1347.             "Login name: " anu::username "\n"
  1348.             "User ID: " anu::UID "\n"
  1349.             "Group ID: " anu::GID "\n"
  1350.             "Real name: " anu::realname "\n"
  1351.             "Home directory: " anu::homedir "\n"
  1352.             "Shell: " anu::shell "\n"))
  1353.        (choices (cat "Add " anu::username) (cat "Skip " anu::username))
  1354.        (help "You can still skip creating the new user"))
  1355.       ((textfile (dest anu::passwd-new)
  1356.              (include anu::passwd)
  1357.              (append anu::passwd-entry))
  1358.        (copyfiles (source anu::passwd)
  1359.               (dest conf-dir)
  1360.               (newname "passwd.old")
  1361.               (optional "askuser"))
  1362.        (copyfiles (source anu::passwd-new)
  1363.               (dest conf-dir)
  1364.               (newname "passwd")
  1365.               (optional "askuser"))
  1366.        (textfile (dest anu::tempfile)
  1367.              (append (cat 
  1368.                   "failat 5000\n"
  1369.                   (tackon bin-dir "passwd") " " anu::username "\n"
  1370.                   "endshell\n"))
  1371.              (safe))
  1372.        (run (cat "newshell from " anu::tempfile)
  1373.         (safe))
  1374.        (set anu::username ""
  1375.         anu::UID (+ anu::UID 1)
  1376.         anu::realname "")))))
  1377.  )
  1378. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1379. (procedure
  1380.  ;;
  1381.  ;; Install passwd and group databases
  1382.  ;;
  1383.  install-user-databases
  1384.  (transcript "Installing user databases")
  1385.  (procedure get-mufs-version
  1386.         (set mufs-vernum (getversion "multiuser.library" (resident)))
  1387.         (set mufs-ver (/ mufs-vernum 65536))
  1388.         (set mufs-rev (- mufs-vernum (* ver 65536))))
  1389.  (procedure passwd-create
  1390.         (copyfiles
  1391.          (prompt "Copying " passwd-source " to AmiTCP:db/passwd.")
  1392.          (source passwd-source)
  1393.          (dest conf-dir)
  1394.          (newname "passwd")
  1395.          (optional "nofail")))
  1396.  (procedure group-create
  1397.         (copyfiles
  1398.          (prompt "Copying " group-source " to AmiTCP:db/group.")
  1399.          (source group-source)
  1400.          (dest conf-dir)
  1401.          (newname "group")
  1402.          (optional "nofail")))
  1403.  (procedure 
  1404.   ;;
  1405.   ;; Change root's password 
  1406.   ;;
  1407.   change-root-password
  1408.   (set iud::script "t:change-root-file")
  1409.   (textfile (dest iud::script)
  1410.         (append 
  1411.          "failat 5000\n"
  1412.          "echo Log in as super-user (root):\n"
  1413.          (tackon bin-dir "login") " root\n"
  1414.          "echo Change the password of root:\n"
  1415.          (tackon bin-dir "passwd") "\n"
  1416.          "endcli")
  1417.         (safe))
  1418.   (message "Logging in as `root' and changing the root's password.")
  1419.   (run (cat "newshell from " iud::script)
  1420.        (safe)))
  1421.  ;; If we are running multiuser 1.4, do some special
  1422.  (get-mufs-version)
  1423.  (if mufs-vernum
  1424.      (transcript ("Multiuser.library %ld.%ld found" mufs-ver mufs-rev)))
  1425.  (if (or (> mufs-ver 39)
  1426.      (and (= mufs-ver 39) (>= mufs-rev 151)))
  1427.      ((transcript "multiuser.library 1.4 or newer detected")
  1428.       (message
  1429.        "\n    You seem to have MultiUser 1.4 installed. In order to ensure "
  1430.        "the most seamless operation between MultiUser 1.4 and "
  1431.        @app-name " you should do following:\n")
  1432.       (message
  1433.        "\nEither make a link from \"AmiTCP:db/passwd\" to "
  1434.        "MultiUser 1.4 \"passwd\" file, for example with command\n\n"
  1435.        "makelink AmiTCP:db/passwd :multiuser/config/passwd\n\n"
  1436.        "or copy MultiUser 1.4 \"passwd\" file and \"MultiUser.config\" to "
  1437.        "directory \"AmiTCP:db/\", then recreate keyfiles with command\n\n"
  1438.        "makekeyfiles AmiTCP:db/ AmiTCP:db/ vol1: vol2:    \n")))
  1439.  (set passwd-source
  1440.       (if (exists "Inet:db/passwd" (noreq)) ; check for AS225r2 compatible
  1441.       "Inet:db/passwd"
  1442.     (tackon source-dir "db/passwd-example")))
  1443.  (set group-source (tackon source-dir "db/group-example"))
  1444.  (if (>= @user-level 2)
  1445.      (message 
  1446.       "\n"
  1447.       "Copying user database from file"
  1448.       "\n\n\"" passwd-source "\"\n\n"
  1449.       "and group database from file"
  1450.       "\n\n\"" group-source "\"\n\n"))
  1451.  (passwd-create)
  1452.  (group-create)
  1453.  (change-root-password))
  1454.  
  1455. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1456. ;;;
  1457. ;;; Installatation sequence
  1458. ;;;
  1459. (complete 00) (transcript "On making " @app-name ".")
  1460. (complete 01) (check-user-level)
  1461. (complete 02) (check-system-version)
  1462. (complete 03) (check-available-memory)
  1463. (complete 04) (check-old-assign)
  1464. (complete 05) (select-destination-directory)
  1465.  
  1466. (if (exists (tackon conf-dir "netdb-myhost"))
  1467.     ( ;; Already configured, ask user what s/he wants to do
  1468.      (transcript @app-name " already configured, presenting options")
  1469.      (while
  1470.      ((complete 10)
  1471.       (set choice
  1472.            (askchoice
  1473.         (prompt @app-name " seems to be already installed. Select "
  1474.             "one of following:")
  1475.         (help "    Installer has detected that the file "
  1476.               "\"AmiTCP:db/netdb-myhost\" exists already. Normally "
  1477.               "this means that the installation has been "
  1478.               "successfully completed.\n"
  1479.               "    You can now select what part of the full "
  1480.               "installation you want to repeat. This selection will "
  1481.               "be repeatedly presented, until \"Done\" is choosed.")
  1482.         (choices "Update Sana-II drivers"        ; 0
  1483.              "Install GNUEmacs support files"    ; 1
  1484.              "Install NapsaTerm fonts"        ; 2
  1485.              "Install user databases"           ; 3
  1486.              "Add new users"                        ; 4
  1487.              "Reconfigure AmiTCP/IP"        ; 5
  1488.              "Done")                ; 6
  1489.         (default 6)))
  1490.       (<> choice 6))
  1491.        (select choice
  1492.            ;; (0)
  1493.            (update-devices)
  1494.            ;; (1)
  1495.            (install-emacstcp)
  1496.            ;; (2)
  1497.            (install-napsaterm)
  1498.            ;; (3)
  1499.            (install-user-databases)
  1500.            ;; (4)
  1501.            (add-new-user)
  1502.            ;; (5)
  1503.            ((transcript "Reconfiguring " @app-name ".")
  1504.         (complete 20) (ask-default-user)
  1505.         (complete 25) (ask-hostname)
  1506.         (complete 30) (ask-aliases)
  1507.         (complete 35) (ask-interfaces)
  1508.         (complete 60) (ask-gateway)
  1509.         (complete 65) (ask-domains)
  1510.         (complete 70) (ask-nameservers)
  1511.         (complete 80) (update-user-startup)
  1512.         (complete 90) (create-startup-script)
  1513.         (complete 95) (create-config-file) ; This must be the last one!
  1514.         ))
  1515.        )
  1516.      )
  1517.   ( 
  1518.    (complete 10) (copy-files-to-destination) ; copy AmiTCP/IP files
  1519.    (complete 20) (update-devices)         ; update Sana-II drivers
  1520.    (complete 30) (ask-install-emacstcp)         ; install EmacsTCP
  1521.    (complete 35) (ask-install-napsaterm)     ; install NapsaTerm
  1522.    (if (if (if old-atcp-directory
  1523.            (exists (tackon old-atcp-directory "db/netdb-myhost") 
  1524.             (noreq)))
  1525.        ((complete 40)
  1526.         (ask-copy-old-configuration)))
  1527.        ((if (exists (tackon conf-dir "passwd"))
  1528.         (transcript "There is already user database.")
  1529.       ((complete 70)
  1530.        (install-user-databases))) ; install passwd/group
  1531.     (complete 90) (update-user-startup)
  1532.     )
  1533.      (;; First time installation, do it all
  1534.       (complete 40) (install-user-databases)    ; install passwd/group
  1535.       (complete 45) (ask-default-user)
  1536.  
  1537.       ;; Configure AmiTCP/IP
  1538.       (complete 50) (ask-hostname)
  1539.       (complete 55) (ask-aliases)
  1540.       (complete 60) (ask-interfaces)
  1541.       (complete 75) (ask-gateway)
  1542.       (complete 80) (ask-domains)
  1543.       (complete 85) (ask-nameservers)
  1544.       (complete 90) (update-user-startup)
  1545.       (complete 95) (create-startup-script)
  1546.       (complete 96) (create-config-file)))    ; This must be the last one!
  1547.    ;; show something
  1548.    (run (cat "run " pager-cmd) (tackon atcp-assign "README.FIRST") (safe))
  1549.    )
  1550.   )
  1551. ;;; All done!
  1552. (complete 100)
  1553. (exit "You should reboot your Amiga to make sure that everything is set "
  1554.       "up properly for the " @app-name ". After the reboot, "
  1555.       (if started-at-boot
  1556.       (cat @app-name " should be running. If this is not a case, "))
  1557.       "type \"run AmiTCP:bin/startnet\" in a command shell to start "
  1558.       @app-name ".")
  1559.  
  1560. ; EOF
  1561.